<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="utils.PageUtil"%>
<%@page import="java.net.URLDecoder"%>
<%@page import="dao.TopicDao"%>
<%@page import="pojo.Topic"%>
<%@page import="dao.NewsDao"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'doupdate.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

</head>

<body>
	<%
		request.setCharacterEncoding("utf-8");
		if (request.getParameter("opr") != null && request.getParameter("opr").equals("deleteTopic")) {
			TopicDao.deleteTopic(Integer.parseInt(request.getParameter("tid")));
		} else if (request.getParameter("opr") != null && request.getParameter("opr").equals("updateTopic")) {
			Topic topc = new Topic();
			topc.setTname(request.getParameter("tname"));
			topc.setTid(Integer.parseInt(request.getParameter("tid")));
			if (TopicDao.updateTopic(topc)) {
	%>
	<script>alert("修改成功")
	</script>
	<%
		} else {
	%>
	<script>alert("修改失败")
	</script>
	<%
		}
		}
	%>
</body>
</html>
